<?php
_lib("IniOperator");
class HeadCol {
	protected static $ini;
	protected static $headcol;
	
	public static function getInstance() {
		if( !self::$ini ) {
			self::$ini = new IniOperator();
		} 
		return self::$ini;
	}
	
	public static function getHeadCol() {
		if( !self::$headcol ) {
			self::$headcol = self::$ini->read(_path("/public/ini/config.ini"))["headcol"];
		}
		return self::$headcol;
	}
	
	public function __construct() {
		self::getInstance();
	}
	
	public function getMobileHead() {
		$data = self::getHeadCol();
		return mb_convert_encoding($data["automobile"], "UTF-8", "GB2312");
	}
	
	public function getPartHead() {
		$data = self::getHeadCol();
		return mb_convert_encoding($data["autopart"], "UTF-8", "GB2312");
	}
	
	public function getConfigHead($headName) {
		$data = self::getHeadCol();
		return mb_convert_encoding($data[$headName], "UTF-8", "GB2312");
	}
	
	public function getAttrHead($typeId) {
		$typeColModel = new TypeColModel();
		return $typeColModel->assocAll("type_id = $typeId", array("name"));
	}
}